<?php
	include("config_gw.php");
	$style = $default_style;
	if (!IsSet($_POST['style'])) {
		if(IsSet($_SESSION['style'])){
			$style = $_SESSION['style'];
		}
		else if (IsSet($_COOKIE['style'])) {
			$style = $_COOKIE['style'];
			$style = base64_decode($style);
		} else {
			$style = $default_style;
		}
	} else {
		$style = $_POST['style'];
		$styel = htmlspecialchars($style);
	}
	if (file_exists("styles/$style/style.css")) {
		echo '<link rel="stylesheet" href="styles/' . $style . '/style.css" type="text/css" />';
	} else {
		$style = $default_style;
		echo '<link rel="stylesheet" href="styles/' . $default_style . '/style.css" type="text/css" />';
	}
	$_SESSION['style'] = $style;
?>